package com.art.springbootspringsession.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * <p>Title: </p >
 * <p>Description: </p >
 *
 * @author Lee
 * @createDate 2021/12/9 15:10
 */
@RestController
public class MyController {
    @RequestMapping("/set")
    public Object set(HttpSession session){
        session.setAttribute("myKey","art!!");
        return "session设置成功";
    }
    @RequestMapping("/get")
    public Object get(HttpSession session){
        String myKey = (String) session.getAttribute("myKey");
        return myKey;
    }
}
